package com.example.controller;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.domain.Business;
import com.example.mapper.BusinessMpper;
import com.example.service.BusinessService;
import com.example.utils.JsonData;
import com.example.utils.config.DBTypeEnum;
import com.example.utils.config.MyDataSource;


@RestController
@RequestMapping("/api/business")
public class BusinessController {
	 @Autowired
	 private BusinessService businessService;
	 @Autowired
	 private BusinessMpper businessMpper;//查询操作不涉及事务所以也可以用 Mapper 层调用

	    /**
	     * 查询所有
	     * @return
	     */
	    @RequestMapping("/findAll")
	    @MyDataSource(DBTypeEnum.DB2)
	    public Object findAll(@RequestBody Map<String,Object> reqMap){
	    	String startData = reqMap.get("startData").toString();
	    	String endData = reqMap.get("endData").toString();
	        List<Business> all = businessMpper.findAll(startData, endData);
	        return JsonData.buildSuccess(all);
	    }

}
